package com.wang.blog.dao;

import com.wang.blog.model.MeTag;
import com.wang.blog.model.MeTagExample;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * MeTagDAO继承基类
 */
@Repository
public interface MeTagDAO extends MyBatisBaseDao<MeTag, Integer, MeTagExample> {

    @Select("select t.*,count(at.tag_id) as count from me_article_tag at  right join" +
            " me_tag t on t.id = at.tag_id " +
            "group by t.id order by count(at.tag_id) desc limit #{limit}")
  List<MeTag> listHotTag(Integer limit);

    @Select("select count(*) from me_article_tag where tag_id=#{tagid}")
    Integer listArticlesByTag(Integer tagid);
}